<template>
  <div>
    <!-- 面包屑导航 -->
    <div class="fz15 fw">短信配置</div>
    <!-- 分割线 -->
    <el-divider></el-divider>
    <el-row>
      <el-col :span="8">
        <el-form :model="form">
          <el-form-item label="姓名称呼" label-width="80px">
            <el-input style="width: 300px" v-model="form.name"></el-input>
          </el-form-item>
        </el-form>
      </el-col>
      <el-col :span="8">
        <el-form :model="form">
          <el-form-item label="接受号码" label-width="80px">
            <el-input style="width: 300px" v-model="form.phone"></el-input>
          </el-form-item>
        </el-form>
      </el-col>
      <el-col :span="8">
        <el-form :model="form">
          <el-form-item label-width="30px">
            <el-button type="primary" @click="onSubmit">添加</el-button>
          </el-form-item>
        </el-form>
      </el-col>
    </el-row>
    <el-divider></el-divider>
    <el-table :data="tableData" style="width: 100%">
      <el-table-column prop="name" label="姓名称呼" width="180" />
      <el-table-column prop="phone" label="接收号码" width="180" />
      <el-table-column label="是否启用" width="180">
        <template #default="scope">
          <el-switch v-model="scope.row.is_switch" />
        </template>
      </el-table-column>
      <el-table-column label="操作" width="200" align="center">
        <template #default="scope">
          <el-button
            type="primary"
            :icon="Edit"
            circle
            @click="isEdit = true"
          />
          <el-button
            type="danger"
            :icon="Delete"
            circle
            @click="delMess(scope.row.id)"
          />
        </template>
      </el-table-column>
    </el-table>
    <el-dialog v-model="isEdit" title="修改信息">
      <el-form :model="form">
        <el-form-item label="姓名称呼" :label-width="formLabelWidth">
          <el-input v-model="form.name" autocomplete="off" />
        </el-form-item>
        <el-form-item label="接收号码" :label-width="formLabelWidth">
          <el-input v-model="form.phone" autocomplete="off" />
        </el-form-item>
      </el-form>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="isEdit = false">取消</el-button>
          <el-button type="primary" @click="addNet"> 确认 </el-button>
        </span>
      </template>
    </el-dialog>
  </div>
</template>
<script setup>
import { ElMessage } from "element-plus";
//按需引入图标
import { Delete, Edit } from "@element-plus/icons-vue";
import { reactive, ref, onMounted } from "vue";
import httpApis from "../../http/index";
const dialogFormVisible = ref(false);
const isEdit = ref(false);
const open2 = () => {
  ElMessage({
    message: "添加成功",
    type: "success",
  });
};
const form = reactive({
  name: "",
  phone: "",
});
const tableData = [
  {
    phone: "18434660818",
    name: "陈先生",
    is_switch: true,
  },
];

function onSubmit() {}
onMounted(() => {});
</script>

<style lang="scss" scoped>
.net-box {
  svg {
    display: none;
  }
  &:hover svg {
    display: block;
  }
}
</style>

